#!/bin/bash
source /etc/profile
echo "---start eureka---"

src=./config/application_template.properties
dest=./config/application.properties

dynamic_update=0
if [ ${dynamic_update} -eq 1 ]
then
   java -cp ./zkclient/zkclient.jar cn.lechange.lczk.ApolloClient host=172.16.0.213:8080 appId=eureka cluster=default namespace=application src=${src} dest=${dest}

   sed -i -e "s#{ip-address}#$inner_host#g" ${dest}
else
   echo "needn't update config, start directly..."
fi

chmod +x eureka.jar
ulimit -c unlimited
ulimit -n 51200
nohup java -server -Dio.netty.leakDetectionLevel=advanced -Djava.security.egd=file:/dev/./urandom -Xms512m -Xmx512m -Xss512K -XX:+HeapDumpOnOutOfMemoryError -jar eureka.jar>/dev/null 2>&1&
